One possible sollution would be would be to have an interceptor that check the action context for the existance of a ServletActionContext.PAGE_CONTEXT variable. If it's available, the action is being executed in a page context.

Detailed discussion is here

Special thanks to Philip Luppens for contributing the idea.